use strict;

if ( scalar(@ARGV) != 2 )
{
	print "USAGE $0 <inner_pattern> <outer_pattern>\n";
	exit;
}

my $pattern_string = join ',', ($ARGV[1], $ARGV[0]);

$pattern_string =~ s/ //g;

my @pattern = split /,/, $pattern_string;

my @pattern_index_map = ( 0,  1,  2,  3, 13, 14, 15,  4, 12, 19, 16,  5, 11, 18, 17,  6, 10,  9,  8,  7 );

my @matrix;

my $i;
foreach $i (0..19)
{
	$matrix[$i] = $pattern[ $pattern_index_map[$i] ];

	my $num = $matrix[$i];

	if ( $num == 0 )
	{
		print "--";
	}
	else
	{
		if ( $num >0 && $num <10 )
		{
			print "0$num";
		}
		else
		{
			print "$num";
		}
	}

	if ( $i % 4 == 3 )
	{
		print "\n";
	}
	elsif ( $i == 9 )
	{
		print " ++ ";
	}
	else
	{	
		print "    ";
	}
}





